package com.ywx.yypicturebackend.api.imagesearch;

import com.ywx.yypicturebackend.api.imagesearch.model.ImageSearchResult;
import com.ywx.yypicturebackend.api.imagesearch.sub.GetImageFirstUrlApi;
import com.ywx.yypicturebackend.api.imagesearch.sub.GetImageListApi;
import com.ywx.yypicturebackend.api.imagesearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;
import java.util.List;

@Slf4j
public class ImageSearchApiFacade {


    /**
     * 以图搜图
     *
     * @param imageUrl
     * @return
     */
    public static List<ImageSearchResult> searchImages(String imageUrl) {
        String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
        List<ImageSearchResult> imageList = GetImageListApi.getImageList(imageFirstUrl);

        return imageList;

    }

}
